package com.chenfan.mcn.model.base;

import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 数据所有人实体
 *
 * @author wulg
 * @date 2021-09-09
 **/
@Data
@EqualsAndHashCode(callSuper = true)
public abstract class BaseOwnerEntity extends BaseEntity {

    private static final long serialVersionUID = -2712053386331053219L;
    /**
     * 数据拥有人id
     */
    @TableField(value="owner_id")
    private Long ownerId;

    /**
     * 数据拥有人
     */
    @TableField(value="owner_name")
    private String ownerName;

    @Override
    public void init(){
        super.init();
        this.ownerId = this.getCreateBy();
        this.ownerName = this.getCreateName();
    }

    @Override
    public void ignore(){
        super.ignore();
        this.ownerId = null;
        this.ownerName = null;
    }
}
